package service

import (
	"context"

	"algo-sdk-go/project/matchmaking/application/command"
	"algo-sdk-go/project/matchmaking/application/dto"
	"algo-sdk-go/project/matchmaking/domain/models/entity"
	"algo-sdk-go/project/matchmaking/domain/port/repo/ops"
	domainService "algo-sdk-go/project/matchmaking/domain/service"
)

type UserProfileService struct {
	matchMakingDomain *domainService.MatchMakingDomain
}

func NewUserProfileService(matchMakingDomain *domainService.MatchMakingDomain) *UserProfileService {
	return &UserProfileService{
		matchMakingDomain: matchMakingDomain,
	}
}

func (m *UserProfileService) AddUserProfile(ctx context.Context, userProfileCmd command.UserProfileCommand) (int, error) {
	return m.matchMakingDomain.SyncUserProfile(ctx, userProfileCmd)
}

func (m *UserProfileService) AppendUserProfile(ctx context.Context, userProfileCmd command.AppendUserprofileCommand) (int, error) {
	return userProfileCmd.UserNum, m.matchMakingDomain.AppendUserProfile(ctx, userProfileCmd)
}

func (m *UserProfileService) GetUserProfile(ctx context.Context, condition ops.Condition) ([]entity.UserProfile, int, error) {
	return m.matchMakingDomain.LoadUserProfile(ctx, condition)
}

func (m *UserProfileService) GetUserAllInfo(ctx context.Context, userNumList []int) ([]dto.UserAllInfo, error) {
	return m.matchMakingDomain.LoadUserAllInfo(ctx, userNumList)
}
